﻿@model InVision_Ticket.Models.Announcement

@{
    ViewBag.Title = "Create";
}

<h2>Create</h2>

<script src="@Url.Content("~/Scripts/jquery-1.9.1.min.js")" type="text/javascript"></script>   
<script src="@Url.Content("~/Scripts/modernizr-1.7.min.js")" type="text/javascript"></script> 

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script src= "@Url.Content("~/Scripts/MarkdownDeepLib.min.js")" type="text/javascript"></script>
<link href="../../Content/mdd_styles.css" rel="stylesheet" type="text/css" />

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Announcement</legend>

        <div class="editor-label">
            Text:
        </div>
            
        <div class="editor-field" id="MainEdit">
            <div class="mdd_toolbar" id="comments_toolbar"></div>
            @Html.TextAreaFor(model => model.Markup, new { @class = "mdd_editor", @id = "details_textarea" })
		    <div class="mdd_resizer" id="comments_resizer"></div>
            <div class="mdd_preview" id="comment_preview"></div>
        </div>

        <div class="editor-label">
            
        </div>
        <div class="editor-field">
            Raw HTML: @Html.EditorFor(model => model.DirectHTML, new { @id="HtmlCheckBox" })
            @Html.ValidationMessageFor(model => model.DirectHTML)
        </div>
        <p>
            <input type="submit" value="Create" />
        </p>
        
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>
<script type="text/javascript">
    function load() {

        $("#DirectHTML").click(function() {
            if ($("#DirectHTML").is(":checked")) {
                $("#MainEdit").html("<textarea cols='80' rows='10' name='HTML' />");
                
        
            }
            else{ location.reload();}
        });
    
    }
    
    $("textarea.mdd_editor").MarkdownDeep({
        help_location: "~/Content/mdd_help.html"

    });
    
    $("#comments_textarea").css("display", "block");
    $("#comments_resizer").css("display", "block");
    $("#comments_toolbar").css("display", "block");
    $("#details_textarea").css("display", "block");
</script>